Expression Value is Not Used (EVNU)

Description:

EVNU detects situations where the expression value is not used. For example, a variable is subsequently assigned two expressions. This message is also reported if the object produced by the new operator is not used, and the object creation operation has no side effects.

When the option Ignore null initializers is set in the audit's properties, EVNU ignores variables initialized with the nil or zero (0) value even if this value is not used afterwards. This is considered a commonly used coding style.

Incorrect:

function copy(list:IList):IList;
var i:integer;
newList:IList;
begin
    newList := nil;
    i := list.Count
    for i := list.Count - 1 to 0 do
        ...
    
    newList = ArrayList.Create;
    ...
end;

Correct:

function copy(list:IList):IList;
var i:integer;
newList:IList;
begin
    newList := nil;
    for  i := list.Count - 1 to 0 do
        ...
    
    newList = ArrayList.Create;
    ...
end;